import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TenantAttestationVO, TenantAttestationForm, TenantAttestationQuery } from '@/api/system/tenantAttestation/types';

/**
 * 查询租户认证列表
 * @param query
 * @returns {*}
 */

export const listTenantAttestation = (query?: TenantAttestationQuery): AxiosPromise<TenantAttestationVO[]> => {
  return request({
    url: '/system/tenantAttestation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询租户认证详细
 * @param tenantId
 */
export const getTenantAttestation = (tenantId: string | number): AxiosPromise<TenantAttestationVO> => {
  return request({
    url: '/system/tenantAttestation/' + tenantId,
    method: 'get'
  });
};

/**
 * 新增租户认证
 * @param data
 */
export const addTenantAttestation = (data: TenantAttestationForm) => {
  return request({
    url: '/cardApplet/appletAddAttestation',
    method: 'post',
    data: data
  });
};
/**
 * 审核租户认证
 * @param data
 */
export const auditTenantAttestation = (data: TenantAttestationForm) => {
  return request({
    url: '/system/tenantAttestation/audit',
    method: 'post',
    data: data
  });
};

/**
 * 修改租户认证
 * @param data/cardApplet/appletAddAttestation
 */
export const updateTenantAttestation = (data: TenantAttestationForm) => {
  return request({
    url: '/system/tenantAttestation',
    method: 'put',
    data: data
  });
};

/**
 * 删除租户认证
 * @param tenantId
 */
export const delTenantAttestation = (tenantId: string | number | Array<string | number>) => {
  return request({
    url: '/system/tenantAttestation/' + tenantId,
    method: 'delete'
  });
};
